
#ifndef _NEBULA_SDK__LOGGER_H_
#define _NEBULA_SDK__LOGGER_H_

#include <stdarg.h>
#include <string>

#include "Utility/DebugLogLevel.h"

#define	LOG   ::nebula::sdk::Logger::debuglog
#define	TLOG  ::nebula::sdk::Logger::translog

#define	LOGV  ::nebula::sdk::Logger::debuglogv
#define	TLOGV ::nebula::sdk::Logger::translogv

namespace nebula { namespace sdk {

using utility::LogLevel;
using utility::LOG_LEVEL_VERBOSE;
using utility::LOG_LEVEL_INFORMATION;
using utility::LOG_LEVEL_ERROR;

class ITask;

class Logger
{
public:
	Logger(const char* module_name);

public:
	//debug log tools
	void pverbose (const char* fmt, ...);
	void pverbosev(const char* fmt, va_list args);
	void pinfo    (const char* fmt, ...);
	void pinfov   (const char* fmt, va_list args);
	void perror   (const char* fmt, ...);
	void perrorv  (const char* fmt, va_list args);

	//transaction/tracking log
	void tlog     (ITask *, const char* fmt, ...);
	void tlogv    (ITask *, const char* fmt, va_list args);

public:
	//debug log tools
	static void debuglog (const char* module_name, LogLevel level, const char* fmt, ...);
	static void debuglogv(const char* module_name, LogLevel level, const char* fmt, va_list args);

	//transaction/tracking log
	static void translog (const char* module_name, LogLevel level, const char* transaction_id, const char* format, ...);
	static void translogv(const char* module_name, LogLevel level, const char* transaction_id, const char* format, va_list);

	//log enable/disable
	static void enable(bool enable_log_disk, bool enable_log_screen);
	static void is_enabled(bool *enable_log_disk, bool *enable_log_screen);

	//log filters
	static void set_filters(LogLevel level, const char* modules);
	static void get_filters(LogLevel *level, char* modules, unsigned int modules_buff_len);

private:
	std::string _module_name;
};

}} // end of nebula::sdk

#endif // _NEBULA_SDK__LOGGER_H_

